package com.zzyl.nursing.job;

import com.zzyl.nursing.service.IAlertRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 设备数据报警处理
 *
 * @Author mr.lcc
 * @Data 2025/5/29 16:20
 */
@Component("AlertRuleJob")
@Slf4j
public class AlertRuleJob {

    @Autowired
    private IAlertRuleService alertRuleService;

    /**
     * 定时进行设备数据对应的报警规则校验，将报警数据保存到对应表中
     */
    public void alertRuleFilter() {
        LocalDateTime now = LocalDateTime.now();
        log.info("[定时任务]开始处理设备报警数据,开始时间：{}", now);
        alertRuleService.alertRuleFilter();
        LocalDateTime end = LocalDateTime.now();
        log.info("[定时任务]设备报警处理完成,结束时间：{}", end);
    }

}
